Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

231
Visualizações
Is "" ( empty-string ) equivalent to boolean false or a false(y) value?

Please explain a little bit on this topic. I have went through some articles but I have not satisfied with their explanations.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The empty string ("") returns falsy. An easy way to understand this is by using the logical AND operator

The logical AND operator

If the first object is falsy, it returns that object

console.log('' && 'hello') // falsy && 'hello' --> returns falsy empty string ('')
console.log('hi' && 'hello') // truthy && 'hello' --> returns 'hello'

  1. In the first console.log() the empty string is a falsy value and so it returns the empty string.

  2. In the second console.log() the non-empty string is a truthy value and so it returns the second string hello

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda